|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectalgalcommand.script.FileIO
public class FileIO
This class is to provide local file operations to the scripts
Copyright Owner: Michigan State University, license number TEC2011-002101Prov
| Field Summary | |
|---|---|
java.lang.String |
SCRIPT_NAME
This is the name of this object from within the javascript |
| Constructor Summary | |
|---|---|
FileIO(java.lang.String pbrkey)
|
|
| Method Summary | |
|---|---|
java.lang.Object |
loadVariable(java.lang.String name)
This is the counter part to the saveVariable(..) methods. |
java.lang.String |
saveReadLocalFile(java.lang.String filepath)
Reads the contents of the specified file as text. |
void |
saveTextToLocalFile(java.lang.String txt,
java.lang.String filepath)
Saves a block of text to a given file path relative to the program folder. |
void |
saveVariable(boolean v,
java.lang.String name)
Saves a variable to a temporary file that will persist after the program closes. |
void |
saveVariable(double v,
java.lang.String name)
Saves a variable to a temporary file that will persist after the program closes. |
void |
saveVariable(int v,
java.lang.String name)
Saves a variable to a temporary file that will persist after the program closes. |
void |
saveVariable(long v,
java.lang.String name)
Saves a variable to a temporary file that will persist after the program closes. |
void |
saveVariable(java.lang.String v,
java.lang.String name)
Saves a variable to a temporary file that will persist after the program closes. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final java.lang.String SCRIPT_NAME
| Constructor Detail |
|---|
public FileIO(java.lang.String pbrkey)
| Method Detail |
|---|
public void saveVariable(boolean v,
java.lang.String name)
throws java.io.IOException
v - The variable to savename - The name of the variable
java.io.IOException - Thrown if there was a problem saving to the file
public void saveVariable(int v,
java.lang.String name)
throws java.io.IOException
v - The variable to savename - The name of the variable
java.io.IOException - Thrown if there was a problem saving to the file
public void saveVariable(long v,
java.lang.String name)
throws java.io.IOException
v - The variable to savename - The name of the variable
java.io.IOException - Thrown if there was a problem saving to the file
public void saveVariable(double v,
java.lang.String name)
throws java.io.IOException
v - The variable to savename - The name of the variable
java.io.IOException - Thrown if there was a problem saving to the file
public void saveVariable(java.lang.String v,
java.lang.String name)
throws java.io.IOException
v - The variable to savename - The name of the variable
java.io.IOException - Thrown if there was a problem saving to the file
public java.lang.Object loadVariable(java.lang.String name)
throws java.io.IOException
saveVariable(..) methods. It
reads from the same file that the corresponding saveVariable(..)
function would have put the data. It returns the most appropriate
object for that variable if it is a number, otherwise, it returns a
String.
name - The name of the variable
java.io.IOException - Thrown if there was a problem saving to the file
public void saveTextToLocalFile(java.lang.String txt,
java.lang.String filepath)
throws java.io.IOException
txt - The text to save to the filefilepath - The relative (a.k.a. local) filepath (e.g.
"notes\t0.txt" will save the text to the file
C:\Program Files\AlgalCommand\notes\t0.txt if
C:\Program Files\AlgalCommand is the program directory for
AlgalCommand)
java.io.IOException - Thrown if the file could not be written to, which
often means that there is a folder of the same name as the file.
public java.lang.String saveReadLocalFile(java.lang.String filepath)
throws java.io.IOException
filepath - The relative (a.k.a. local) filepath (e.g.
"notes\t0.txt" will read the text from the file
C:\Program Files\AlgalCommand\notes\t0.txt if
C:\Program Files\AlgalCommand is the program directory for
AlgalCommand)
java.io.IOException - Thrown if the file cannot be read (e.g.
filepath points to a folder).
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||